import { defineStore } from 'pinia';
import { ref } from 'vue';

export const useShortcutStore = defineStore('shortcut-store', () => {
  const useClickDelete = ref<boolean>(false);
  function clickDeleteChange(value: string | number | boolean) {
    if (value) {
      selectMapElement.value = false;
      beginExchange.value = false;
    }
  }
  // 选择地图元素
  const selectMapElement = ref<boolean>(false);
  function selectElementChange(value: string | number | boolean) {
    if (value) {
      useClickDelete.value = false;
      beginExchange.value = false;
    }
  }
  const auxiliaryLine = ref<boolean>(true);

  // 交换快捷
  const beginExchange = ref<boolean>(false);
  function selectBeginExchange(value: string | number | boolean) {
    if (value) {
      selectMapElement.value = false;
      useClickDelete.value = false;
    }
  }

  return {
    selectMapElement,
    selectElementChange,

    useClickDelete,
    clickDeleteChange,

    auxiliaryLine,
    beginExchange,
    selectBeginExchange,
  };
});
